package com.example.demo.controller;

import com.example.demo.common.ResultAjax;
import com.example.demo.model.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/getuser")
    public ResultAjax getUser(){
        System.out.println("do getUser()");
        return ResultAjax.success("getuser");
    }

    @RequestMapping("/reg")
    public ResultAjax reg(){
        System.out.println("do reg()");
//        Object obj = null;
//        System.out.println(obj.hashCode());
        return ResultAjax.success("reg");
    }

    @RequestMapping("/login")
    public ResultAjax login(){
        System.out.println("do login()");
//        int num = 10 / 0;
        return ResultAjax.success("login");
    }

    @RequestMapping("/getnum")
    public int getNum(){
        System.out.println("getNum()");
        return 1;
    }

    @RequestMapping("/getstr")
    public String getStr(){
        System.out.println("getStr()");
        return "whoooooo~~";
    }

    @RequestMapping("/usermsg")
    public User usermsg(){
        User user = new User();
        user.setId(263);
        user.setName("柳飘飘");
        user.setPassword("96134");
        return user;
    }
}
